/*--------------------------------------------------------------------------------------*\
**
** t_adventure_event_base.h
**
** Heroes IV
** Copyright 2000, The 3DO Company
**
\*--------------------------------------------------------------------------------------*/

#if !defined( ADVENTURE_EVENT_MOVER_H_INCLUDED)
#define ADVENTURE_EVENT_MOVER_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <list>

#include "adventure_events_base.h"
#include "adventure_path.h"
#include "replay_mover.h"
#include "counted_ptr.h"

// --------------------------------------------------------------------------
// t_adventure_event_mover class : this event class is responsible for captureing the
// army movements. It also handles user on_halt commands for a given path.
// --------------------------------------------------------------------------

class t_army;

typedef t_counted_ptr<t_replay_mover> t_replay_mover_ptr;

enum t_direction;

class t_adventure_event_mover : public t_adventure_event_base
{
public:
	// Constructor
	t_adventure_event_mover();
	t_adventure_event_mover( t_army* army, t_adventure_path const & path, bool limit_move, t_adv_map_point orig_point);

	virtual void cancel_event();

	virtual void execute_event( t_adventure_map* map , t_saved_game_header const & header ) ;
	virtual void undo_event( t_adventure_map* map , t_saved_game_header const & header );

	virtual bool	read( std::streambuf & buffer , int version );
	virtual bool	write( std::streambuf & buffer );
	
	virtual void	update( );

protected:

	void			preprocess_path( t_adventure_path const & path, t_level_map_point_2d army_pos );
	void			mover_finish();

	bool							m_limit_move;
	t_adventure_path				m_path;

	t_adv_map_point					m_begin;
	t_adv_map_point					m_end;
	
	t_direction						m_begin_dir;
	t_direction						m_end_dir;

	t_replay_mover_ptr				m_army_mover;
};

#endif // ADVENTURE_EVENT_MOVER_H_INCLUDED

